package com.lormann.android.infoterminal;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class Report extends Activity {

	private static final String TAG="Report ";
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.report);
		
		setupActionReference();
		Log.d(TAG,"OnCreate !! ");
		Toast.makeText(Report.this, this.toString()+" : OnCreate !! ",
				Toast.LENGTH_SHORT).show();
	}
	
	private void setupActionReference()
	{
		//alloc button and link to resource
		Button endButton=(Button)findViewById(R.id.endButton);
		Button getIntentDataButton=(Button)findViewById(R.id.button_GetIntentData);
					
		//setup action to button
		endButton.setOnClickListener(endButtonAction);
		getIntentDataButton.setOnClickListener(getIntentDataButtonAction);
		
		//Test button Setting
		Button mainButton=(Button) findViewById(R.id.button_main);
		Button reportButton=(Button) findViewById(R.id.button_report);
		Button aboutmeButton=(Button) findViewById(R.id.button_aboutme);
		Button settingButton=(Button) findViewById(R.id.button_setting);
		
		button_action main_button_actions=new button_action(Report.this);
		
		mainButton.setOnClickListener(main_button_actions.open_main_activity);
		reportButton.setOnClickListener(main_button_actions.open_report_activity);
		aboutmeButton.setOnClickListener(main_button_actions.open_aboutme_activity);
		settingButton.setOnClickListener(main_button_actions.open_setting_activity);
	}
	
	private OnClickListener getIntentDataButtonAction=new OnClickListener(){

		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			// show info via Toast
			Bundle bundle=Report.this.getIntent().getExtras();
			Toast.makeText(Report.this, bundle.getString("KEY_USRNAME"),
					Toast.LENGTH_SHORT).show();
			
		}
		
	};
	
	private OnClickListener endButtonAction=new OnClickListener(){

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Report.this.finish();
		}
		
	};
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		Log.d(TAG,"onPause !! ");
		super.onPause();		
		Toast.makeText(Report.this, this.toString()+" : onPause !! ",
				Toast.LENGTH_SHORT).show();
		
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		Log.d(TAG,"onDestroy !! ");
		Toast.makeText(Report.this, this.toString()+" : onDestroy !! ",
				Toast.LENGTH_SHORT).show();
	}

	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
		Log.d(TAG,"onRestart !! ");
		Toast.makeText(Report.this, this.toString()+" : onRestart !! ",
				Toast.LENGTH_SHORT).show();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		Log.d(TAG,"onResume !! ");
		Toast.makeText(Report.this, this.toString()+" : onResume !! ",
				Toast.LENGTH_SHORT).show();
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		Log.d(TAG,"onStart !! ");
		Toast.makeText(Report.this, this.toString()+" : onStart !! ",
				Toast.LENGTH_SHORT).show();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		Log.d(TAG,"onStop !! ");
		Toast.makeText(Report.this, this.toString()+" : onStop !! ",
				Toast.LENGTH_SHORT).show();
	}
	
	
}
